unit uWybierzPM;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Db, ADODB, Buttons, StdCtrls, twStringList;

type
  TFWybierzPM = class(TForm)
    Conn: TADOConnection;
    Button1: TButton;
    Button2: TButton;
    BitBtn1: TBitBtn;
    Qt: TADOQuery;
    slPM: TtwStringList;
    procedure FormShow(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    Koniec : integer;
    BazaDyn : string;
  end;

var
  FWybierzPM: TFWybierzPM;

implementation

{$R *.DFM}

uses Wilk;

procedure TFWybierzPM.FormShow(Sender: TObject);
var
  s : string;
  i : integer;
begin
  Koniec := 0;
  slPM.StringList.Clear;
  SQLOpen(Qt, 'SELECT Opis FROM '+BazaDyn+'..TW_SLOWNIK with (NOLOCK) WHERE Kod=100');
  while not Qt.EOF do
  begin
    s := trim(Qt.Fields[0].AsString);
    i := Pos('-', s);
    s := Copy(s, i+1, Length(s));
    slPM.StringList.Add(s);
    Qt.Next;
  end;
  Qt.Close;
end;

procedure TFWybierzPM.Button1Click(Sender: TObject);
begin
  Koniec := 1;
  Close;
end;

procedure TFWybierzPM.Button2Click(Sender: TObject);
begin
  koniec := 2;
  Close;
end;

end.
